package com.xicheng.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * <p>
 * 题目表
 * </p>
 *
 * @author com.xicheng
 * @since 2025-09-08
 */
@Getter
@Setter
@ToString
@TableName("questions")
@Accessors(chain = true)
public class Questions extends Model<Questions> {

    /**
     * 题目ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 题目内容
     */
    @TableField("content")
    private String content;

    /**
     * 题型：1-单选，2-多选，3-判断，4-填空
     */
    @TableField("type")
    private Boolean type;

    /**
     * 选项（JSON格式）
     */
    @TableField("options")
    private String options;

    /**
     * 答案
     */
    @TableField("answer")
    private String answer;

    /**
     * 分值
     */
    @TableField("score")
    private BigDecimal score;

    /**
     * 关联书籍ID
     */
    @TableField("book_id")
    private Integer bookId;

    /**
     * 关联阶段ID
     */
    @TableField("stage_id")
    private Integer stageId;

    /**
     * 创建者（老师ID）
     */
    @TableField("created_by")
    private Integer createdBy;

    @TableField("created_at")
    private LocalDateTime createdAt;

    @TableField("updated_at")
    private LocalDateTime updatedAt;

    @Override
    public Serializable pkVal() {
        return this.id;
    }
}
